import QtQuick
import QtQuick.Controls
import com.company.color_convert 1.0

Window {
     width: 223
     height: 88
    visible: true
    title: qsTr("color convert")
    Color_Convert
    {
        id: convert
        onColor_changed_rgb565:function(color){
            input_rgb565.text = color
        }
        onColor_changed_rgb888:function(color){input_rgb888.text = color}
        onColor_changed_argb8888:function(color){input_argb8888.text = color}
    }

    Column
    {
        x:4
        y:4
        spacing: 3
        anchors.margins: 2
        Row{
            spacing: 3
            Text {
                id: name_rgb565
                width:name_argb8888.width
                height: 25
                font.pointSize: 10
                text: qsTr("RGB565: ")
                horizontalAlignment: Text.AlignRight
                verticalAlignment: Text.AlignVCenter
            }
            Rectangle {
                width: 100
                height: 25
                color: "lightgrey"
                border.color: "grey"
                TextInput{
                    id: input_rgb565
                    anchors.fill: parent
                    anchors.margins: 2
                    horizontalAlignment:TextInput.AlignLeft
                    verticalAlignment: TextInput.AlignVCenter
                }
            }
            Button{
                id:btn_rgb565
                width: 35
                height: 25
                text: qsTr("转换")
                onClicked: {
                    convert.color_565 = input_rgb565.text
                }
            }
        }
        Row{
            spacing: 3
            Text {
                id: name_rgb888
                width:name_argb8888.width
                height: 25
                font.pointSize: 10
                text: qsTr("RGB888: ")
                horizontalAlignment: Text.AlignRight
                verticalAlignment: Text.AlignVCenter
            }
            Rectangle {
                width: 100
                height: 25
                color: "lightgrey"
                border.color: "grey"
                TextInput{
                    id: input_rgb888
                    anchors.fill: parent
                    anchors.margins: 2
                    horizontalAlignment:TextInput.AlignLeft
                }
            }
            Button{
                height: 25
                width: 35
                text: qsTr("转换")
                onClicked: {
                    convert.color_888 = input_rgb888.text
                }
            }
        }
        Row{
            spacing: 3
            Text {
                id: name_argb8888
                height: 25
                font.pointSize: 10
                text: qsTr("ARGB8888: ")
                horizontalAlignment: Text.AlignRight
                verticalAlignment: Text.AlignVCenter
            }
            Rectangle {
                width: 100
                height: 25
                color: "lightgrey"
                border.color: "grey"
                TextInput{
                    id: input_argb8888
                    anchors.fill: parent
                    anchors.margins: 2
                    horizontalAlignment:TextInput.AlignLeft
                }
            }
            Button{
                height: 25
                width: 35
                text: qsTr("转换")
                onClicked: {
                    convert.color_8888 = input_argb8888.text
                }
            }
        }
    }





}
